<!-- author: lilonghe@outlook.com date: 2017/5/17 -->
<!DOCTYPE html>
<html>
<head>
    <title>教师管理后台</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="/css/main.css">
</head>

<body>
<div class='teacher-container' id='app'>
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">
                    名师到教师管理后台
                </a>
            </div>
            <ul class="nav navbar-nav">
                <li class="active"><a href="teacher-course.html">课程数据</a></li>
                <!-- <li><a href="#">账户安全</a></li> -->
            </ul>


            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">退出</a></li>
            </ul>
        </div>
    </nav>
    <div class="form">
        <select class="form-control">
            <option>本月</option>
        </select>
        <select class="form-control">
            <option>学段</option>
        </select>
        <input type="text" name="" placeholder="学校" class="form-control">
        <select class="form-control">
            <option>年级</option>
        </select>
        <input type="number" name="" placeholder="班级, 例：1" min="1" class="form-control">
        <input id='btn-search' type="button" name="" value='搜索' class='btn btn-primary'>

        <br/>
        <input type="date" name="" placeholder="年-月-日" class="form-control"><span class="time-center">至</span>
        <input type="date" name="" placeholder="年-月-日" class="form-control">

        <select class="pro form-control" v-model="pid" @change="prochange()" class="">
        <option value="0" selected>全部省</option>
        <option :value="v.id" v-for="v in pro">${v.name}</option>
        </select>
        <select class="city form-control" v-model="cid" @change="citychange()" class="form-control">
        <option value="0">全部市</option>
        <option :value="v.id" v-for="v in city">${v.name}</option>
        </select>
        <select class="county form-control" v-model="ccid" class="form-control">
            <option value="0">全部县</option>
            <option :value="v.id" v-for="v in county">${v.name}</option>
        </select>
    </div>

    <div class="content">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th>序号</th>
                <th>单节视频</th>
                <th>点播次数</th>
                <th>播放时长超过30%</th>
                <th>播放时长超过70%</th>
                <th>点播用户数</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>qrq</td>
                <td>sdfsd</td>
                <td>sdfsdds</td>
                <td>sdfsdfds</td>
                <td>sdfsf</td>
                <td>sdfdsfsd</td>
            </tr>

            <tr>
                <td>总计</td>
                <td>sdfsd</td>
                <td>sdfsdds</td>
                <td>sdfsdfds</td>
                <td>sdfsf</td>
                <td>sdfdsfsd</td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="6">
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <li>
                                <a href="#" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li>
                                <a href="#" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</html>

<script type="text/javascript">
    var main_host = 'http://rapapi.org/mockjsdata/13896/wechat/v1';

    var app = new Vue({
        delimiters: ['${', '}'],
        el: '#app',
        data: {
            pid: 0,
            pro: null,
            cid: 0,
            city: null,
            ccid: 0,
            county: null
        },
        created: function(){
            this.getArea(function(res){
                this.pro = res;
                this.pid = 0;
            }.bind(this));
        },
        methods:{
            prochange:function(){
                this.getArea(function(res){
                    this.city = res;
                    this.cid = 0;
                    this.citychange();
                }.bind(this),this.pid);
            },
            citychange:function(){
                this.getArea(function(res){
                    this.county = res;
                    this.ccid = 0;
                }.bind(this),this.cid);
            },
            getArea: function(cb,id){
                $.ajax({
                    url: main_host + '/vip/area',
                    data: {
                        id: id
                    },
                    success: function(res){
                        cb && cb(res.data);
                    },
                    fail: function(err){
                        console.log(err);
                    }
                });
            }
        }
    })


</script>
